# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: CRT <crt.011@gmail.com>
# Contributor: Sébastien Duquette <ekse.0x@gmail.com>
# Contributor: icarus <icarus.roaming@gmail.com>
# Contributor: Stephane Travostino <stephane.travostino@gmail.com>

pkgname=cowpatty
pkgver=4.8
pkgrel=3
pkgdesc='Wireless WPA/WPA2 PSK handshake cracking utility'
url='https://github.com/joswr1ght/cowpatty'
arch=('loong64' 'x86_64')
license=('GPL')
depends=('openssl' 'libpcap')
options=('!makeflags')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/joswr1ght/cowpatty/archive/${pkgver}.tar.gz)
sha512sums=('a0a6ef859e0d1a5d753377b8eac50ef46ded7c1ddae50795bdc1170a5c8b572a3ae397ac9bcb9341863a69f0d2dc3e24d9727873baa10c3ee730d8dc6a8d0683')

prepare() {
  cd ${pkgname}-${pkgver}
  sed -E 's|(= -pipe)|+\1|g' -i Makefile
  sed 's|-g3 -ggdb||g' -i Makefile
  sed '/clang/d' -i Makefile
  sed -E "s/(cowpatty.c -o|genpmk.c -o)/${LDFLAGS} \\1/g" -i Makefile
}

build() {
  cd ${pkgname}-${pkgver}
  CFLAGS+=" ${CPPFLAGS}"
  make all strip
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" BINDIR=/usr/bin install
  install -Dm 644 dict "${pkgdir}/usr/share/cowpatty/dict"
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
